package com.itheima.controller;

import com.itheima.dtos.ArticleHomeDto;
import com.itheima.service.ArticleService;
import com.itheima.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangjiexin
 */
@RestController
@RequestMapping("/api/v1/article")
public class ArticleController {
    @Autowired
    private ArticleService articleService;
    @PostMapping("/load")
    public CommonResult load(@RequestBody ArticleHomeDto dto){
        return CommonResult.success(articleService.load(dto));
    }

    @PostMapping("/loadmore")
    public CommonResult loadmore(@RequestBody ArticleHomeDto dto){
        return CommonResult.success(articleService.loadmore(dto));
    }

    @PostMapping("/loadnew")
    public CommonResult loadnew(@RequestBody ArticleHomeDto dto){
        return CommonResult.success(articleService.loadnew(dto));
    }


}
